Page({
  data: {
    tips_list: [
      { id: 1, name: '童万登', username: 'tongwandeng', head_pic: "登", tips: '童万登想把任务 墨量预警 转单给你', taskname: '墨量预警' },
      { id: 2, name: '倪忠卫', username: 'nizhongwei', head_pic: "卫", tips: '倪忠卫想把任务 卡纸故障 转单给你', taskname: '卡纸故障' },
      { id: 3, name: '王培栋', username: 'wangpeidong', head_pic: "栋", tips: '王培栋想把任务 墨量预警c 转单给你', taskname: '墨量预警c' },
      { id: 4, name: '李邵瑜', username: 'lishaoyu', head_pic: "瑜", tips: '李邵瑜想把任务 墨量预警k 转单给你', taskname: '墨量预警k' },
      { id: 5, name: '小胖', username: 'xiaopang', head_pic: "胖", tips: '小胖想把任务 墨量预警 转单给你m', taskname: '墨量预警' }
    ]
  },
  onLoad: function () {
    // 给头像分配颜色
    var colorArr = ['#5D9050', '#5E8DA3', '#2156B5', '#289787', '#CD241A', '#3CA1D2', '#589358', '#5E8DA3', '#367F64', '#D39E53', '#CB374C', '#7F6F76', '#06A3A3', '#06A3A3', '#3F1850'];
    for (var i = 0; i < this.data.tips_list.length; i++) {
      var item = 'tips_list[' + i + '].background_pic';
      if (colorArr.length > this.data.tips_list.length) {
        this.setData({
          [item]: colorArr[i]
        })
      } else {
        this.setData({
          [item]: colorArr[Math.floor(Math.random() * colorArr.length)]
        })
      }
    }
  },
  getTurnInfo: function (e) {
    wx.navigateTo({
      url: '/pages/info/info?name=' + e.currentTarget.id + '&turnId=1',
    })
  },
  goBack: function () {
    wx.navigateBack({ changed: true });
  }
})